import 'dart:io';

import 'package:device_info_plus/device_info_plus.dart';

class DeviceInfoUtil {
  static Future<DeviceBean> getInfo() async {
    // await Permission.phone.request();
    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
    DeviceBean bean;
    // String imei = await PlatformDeviceId.getDeviceId ?? '';
    if (Platform.isAndroid) {
      AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
      bean = DeviceBean(
        brand: androidInfo.brand,
        // deviceId: imei,
        systemVersion: androidInfo.version.release,
        model: androidInfo.model,
      );
    } else {
      IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
      bean = DeviceBean(
        brand: iosDeviceInfo.systemName,
        // deviceId: imei,
        systemVersion: iosDeviceInfo.systemVersion,
        model: iosDeviceInfo.model,
      );
    }
    return bean;
  }
}

class DeviceBean {
  // final String deviceId;
  final String brand;
  final String systemVersion;
  final String model;
  DeviceBean(
      {
      // required this.deviceId,
      required this.brand,
      required this.systemVersion,
      required this.model});
}
